<template>
    <div id="query">
        <div id="qrcode" ref="qrcode"></div>
    </div>
</template>

<script>

    export default {
        name: "QrCode",
        props: {
            url: {type: String, default: ''}
        },
        components: {
            // QRCode: () => import('qrcodejs2').then(m => m.QRCode)
            //     .catch()
        },
        methods: {
            // 动态生成二维码
            async qrcode() {
                let qr = await                 import('qrcodejs2')
                let qrc=qr.default
                let qrcode = new qrc('qrcode', {
                    width: 200, // 设置宽度，单位像素
                    height: 200, // 设置高度，单位像素
                    text: this.url   // 设置二维码内容或跳转地址
                })


            }
        },
        created() {
            this.$nextTick(() => {
                this.qrcode()
            })
        }


    }
</script>

<style scoped>

</style>